<?php

class Travel extends Frank implements iFrank {

    private $lat;
    private $lon;
    private $displayOrder;

    //Getters
    public function lat() {
        return $this->lat;
    }

    public function lon() {
        return $this->lon;
    }

    public function __construct($id, $name, $lat, $lon, $displayOrder) {
        $this->id = $id;
        $this->name = $name;
        $this->lat = $lat;
        $this->lon = $lon;
        $this->displayOrder = $displayOrder;
    }

    public static function getObject($row) {
        return new Travel($row["id"], $row["place"], $row["latitude"], $row["longitude"], $row["display_order"]);
    }

    public static function getAll($toArray = false, $fields = null, $query = null, $db = null) {
        $query = "select * from `" . TRAVEL_TABLE . "` order by display_order";
        return parent::getAll($toArray, $fields, $query, $db);
    }
    
    public static function getById($id, $toArray = false, $fields = null, $query = null, $db = null){
        $query = 'select * from `' . TRAVEL_TABLE . '` where travel_id = '.$id;
        return parent::getById($id, $toArray, $fields, $query, $db);
    }

}

?>